#!/usr/bin/python

import re

#
#   regex pattern
example_regex = re.compile("([^.]+)(?:\..*)?") # "NM_001011874.1"

#
#   where to search
string_with_interesting_data = "NM_001011874.1 and something else"

matching_result = example_regex.search(string_with_interesting_data)
if not matching_result:
    sys.stderr.write("Not found\n")
found_str = matching_result.group(1)

